package c.e.a.a.f.p.h;

import android.content.Context;
import c.e.a.a.f.p.i.c;

/* compiled from: JobInfoScheduler */
public class d implements r {
    public final Context a;
    public final c b;
    public final f c;

    public d(Context context, c cVar, f fVar) {
        this.a = context;
        this.b = cVar;
        this.c = fVar;
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x009d  */
    /* JADX WARNING: Removed duplicated region for block: B:13:0x0097  */
    public void a(c.e.a.a.f.h r18, int r19) {
        /*
        r17 = this;
        r0 = r17;
        r1 = r18;
        r2 = r19;
        r3 = new android.content.ComponentName;
        r4 = r0.a;
        r5 = com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService.class;
        r3.<init>(r4, r5);
        r4 = r0.a;
        r5 = "jobscheduler";
        r4 = r4.getSystemService(r5);
        r4 = (android.app.job.JobScheduler) r4;
        r5 = new java.util.zip.Adler32;
        r5.<init>();
        r6 = r0.a;
        r6 = r6.getPackageName();
        r7 = "UTF-8";
        r8 = java.nio.charset.Charset.forName(r7);
        r6 = r6.getBytes(r8);
        r5.update(r6);
        r6 = r18.b();
        r7 = java.nio.charset.Charset.forName(r7);
        r6 = r6.getBytes(r7);
        r5.update(r6);
        r6 = 4;
        r7 = java.nio.ByteBuffer.allocate(r6);
        r8 = r18.d();
        r8 = c.e.a.a.f.s.a.a(r8);
        r7 = r7.putInt(r8);
        r7 = r7.array();
        r5.update(r7);
        r7 = r18.c();
        if (r7 == 0) goto L_0x0065;
    L_0x005e:
        r7 = r18.c();
        r5.update(r7);
    L_0x0065:
        r7 = r5.getValue();
        r5 = (int) r7;
        r7 = r4.getAllPendingJobs();
        r7 = r7.iterator();
    L_0x0072:
        r8 = r7.hasNext();
        r9 = "attemptNumber";
        if (r8 == 0) goto L_0x0092;
    L_0x007a:
        r8 = r7.next();
        r8 = (android.app.job.JobInfo) r8;
        r12 = r8.getExtras();
        r12 = r12.getInt(r9);
        r8 = r8.getId();
        if (r8 != r5) goto L_0x0072;
    L_0x008e:
        if (r12 < r2) goto L_0x0092;
    L_0x0090:
        r7 = 1;
        goto L_0x0093;
    L_0x0092:
        r7 = 0;
    L_0x0093:
        r8 = "JobInfoScheduler";
        if (r7 == 0) goto L_0x009d;
    L_0x0097:
        r2 = "Upload for context %s is already scheduled. Returning...";
        b.i.b.f.m0(r8, r2, r1);
        return;
    L_0x009d:
        r7 = r0.b;
        r12 = r7.a0(r1);
        r7 = r0.c;
        r14 = new android.app.job.JobInfo$Builder;
        r14.<init>(r5, r3);
        r3 = r18.d();
        r10 = r7.b(r3, r12, r2);
        r14.setMinimumLatency(r10);
        r7 = r7.c();
        r3 = r7.get(r3);
        r3 = (c.e.a.a.f.p.h.f.a) r3;
        r3 = r3.c();
        r7 = c.e.a.a.f.p.h.f.b.NETWORK_UNMETERED;
        r7 = r3.contains(r7);
        r10 = 2;
        if (r7 == 0) goto L_0x00d1;
    L_0x00cc:
        r14.setRequiredNetworkType(r10);
        r7 = 1;
        goto L_0x00d5;
    L_0x00d1:
        r7 = 1;
        r14.setRequiredNetworkType(r7);
    L_0x00d5:
        r11 = c.e.a.a.f.p.h.f.b.DEVICE_CHARGING;
        r11 = r3.contains(r11);
        if (r11 == 0) goto L_0x00e0;
    L_0x00dd:
        r14.setRequiresCharging(r7);
    L_0x00e0:
        r11 = c.e.a.a.f.p.h.f.b.DEVICE_IDLE;
        r3 = r3.contains(r11);
        if (r3 == 0) goto L_0x00eb;
    L_0x00e8:
        r14.setRequiresDeviceIdle(r7);
    L_0x00eb:
        r3 = new android.os.PersistableBundle;
        r3.<init>();
        r3.putInt(r9, r2);
        r7 = r18.b();
        r9 = "backendName";
        r3.putString(r9, r7);
        r7 = r18.d();
        r7 = c.e.a.a.f.s.a.a(r7);
        r9 = "priority";
        r3.putInt(r9, r7);
        r7 = r18.c();
        if (r7 == 0) goto L_0x011e;
    L_0x010f:
        r7 = r18.c();
        r9 = 0;
        r7 = android.util.Base64.encodeToString(r7, r9);
        r11 = "extras";
        r3.putString(r11, r7);
        goto L_0x011f;
    L_0x011e:
        r9 = 0;
    L_0x011f:
        r14.setExtras(r3);
        r3 = 5;
        r3 = new java.lang.Object[r3];
        r3[r9] = r1;
        r5 = java.lang.Integer.valueOf(r5);
        r7 = 1;
        r3[r7] = r5;
        r5 = r0.c;
        r1 = r18.d();
        r15 = r5.b(r1, r12, r2);
        r1 = java.lang.Long.valueOf(r15);
        r3[r10] = r1;
        r1 = 3;
        r5 = java.lang.Long.valueOf(r12);
        r3[r1] = r5;
        r1 = java.lang.Integer.valueOf(r19);
        r3[r6] = r1;
        r1 = "Scheduling upload for context %s with jobId=%d in %dms(Backend next call timestamp %d). Attempt %d";
        b.i.b.f.n0(r8, r1, r3);
        r1 = r14.build();
        r4.schedule(r1);
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.a.a.f.p.h.d.a(c.e.a.a.f.h, int):void");
    }
}
